#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

const double eps = 1e-8;

bool Eq(double a, double b)
{
	return fabs(a - b) < eps;
}

bool Ls(double a, double b)
{
	return a < b && !Eq(a, b);
}

double mySqrt(double a)
{
	if (Ls(a, 0))
		throw;
	if (a < 0)
		return 0;
	return sqrt(a);
}

struct Point
{
	double x, y;
	Point () : x(), y() {}
	Point (double _x, double _y) : x(_x), y(_y) {}
	Point operator + (Point a)
	{
		return Point(x + a.x, y + a.y);
	}
	Point operator - (Point a)
	{
		return Point(x - a.x, y - a.y);
	}
	Point operator * (double k)
	{
		return Point(x * k, y * k);
	}
	Point operator / (double k)
	{
		return Point(x / k, y / k);
	}
	double operator * (Point a)
	{
		return x * a.y - y * a.x;
	}
	double operator % (Point a)
	{
		return x * a.x + y * a.y;
	}
	double len()
	{
		return mySqrt(x * x + y * y);
	}
	Point norm()
	{
		return *this / len();
	}
	void scan()
	{
		scanf("%lf%lf", &x, &y);
	}
	void print()
	{
		printf("%.10lf %.10lf\n", x, y);
	}
};

Point intersectLine(Point A, Point v, Point B, Point u)
{
	double k = (A * v - B * v) / (u * v);
	return B + u * k;
}

Point mirrorPoint(Point A, Point v, Point P)
{
	v = v.norm();
	double l = (P - A) % v;
	Point H = A + v * l;
	Point u = H - P;
	return H + u;
}

struct Item
{
	Point A, v;
	int type;
	Item () : A(), v(), type() {}
	Item (int t, Point P) : type(t), A(P), v() {}
	Item (int t, Point P, Point _v) : type(t), A(P), v(_v) {}

	Item operate (Item x)
	{
		if (type == 0)
		{
			if (x.type == 0)
				return Item(1, A, x.A - A);
			return Item(0, mirrorPoint(x.A, x.v, A));
		}
		if (x.type == 0)
			return Item(0, mirrorPoint(A, v, x.A));
		return Item(0, intersectLine(A, v, x.A, x.v));
	}
};

const int N = (int)1e2 + 100;
char str[N];
int nextOp[N], nextComma[N];
int st[N];
int pairBr[N];
int len;
Item results[N][N];
bool used[N][N];

void calcInfo()
{
	nextOp[len] = len;
	nextComma[len] = len;
	for (int i = len - 1; i >= 0; i--)
	{
		nextOp[i] = nextOp[i + 1];
		nextComma[i] = nextComma[i + 1];
		if (str[i] == '@')
			nextOp[i] = i;
		if (str[i] == ',')
			nextComma[i] = i;

	}
	int topSt = 0;
	for (int i = 0; i < len; i++)
	{
		if (str[i] == '(')
			st[topSt++] = i;
		else if (str[i] == ')')
		{
			int x = st[topSt - 1];
			topSt--;
			pairBr[x] = i;
			pairBr[i] = x;
		}
	}
}

int getNumber(int l, int r)
{
	int sgn = 1;
	if (str[l] == '-')
	{
		sgn = -1;
		l++;
	}
	int value = 0;
	for (int i = l; i <= r; i++)
	{
		value *= 10;
		value += str[i] - '0';
	}
	return value * sgn;
}

void initResults()
{
	memset(used, 0, sizeof(used));
	for (int i = 0; i < len; i++)
	{
		if (str[i] != '(')
			continue;
		int nxt = pairBr[i];
		int op = nextOp[i];

		if (op > nxt && str[i + 1] != '(')
		{
			int mid = nextComma[i];
			int a = getNumber(i + 1, mid - 1);
			int b = getNumber(mid + 1, nxt - 1);
			results[i + 1][nxt - 1] = Item(0, Point(a, b));
			used[i + 1][nxt - 1] = 1;
		}
	}
}

Item solve(int l, int r)
{
	if (used[l][r])
		return results[l][r];
	if (str[l] == '(' && pairBr[l] == r)
		return solve(l + 1, r - 1);
	Item value;
	bool isFirst = true;
	for (int i = l; i <= r; i = pairBr[i] + 2)
	{
		int a = i;
		int b = pairBr[i];
		if (isFirst)
			value = solve(a, b);
		else
			value = value.operate(solve(a, b));
		isFirst = false;
	}
	used[l][r] = 1;
	results[l][r] = value;
	return value;
}

int main()
{
	freopen ("input.txt", "r", stdin);
	freopen ("output.txt", "w", stdout);
	while (1)
	{
		scanf(" %s", str);
		if (str[0] == '#')
			break;
		len = strlen(str);
		calcInfo();
		initResults();
		Item ans = solve(0, len - 1);
		ans.A.print();
	}
	return 0;
}